package com.boot2.core.exception;

import com.boot2.core.web.RequestContext;
import lombok.extern.apachecommons.CommonsLog;

import javax.servlet.http.HttpServletRequest;

/**
 * 
 * @ClassName: LoginException
 * @description: 未登录异常
 * @author zhangweilin
 * @date 2017年12月19日 下午4:52:11
 *
 */
@CommonsLog
public class NotLoginedException extends BusinessException {

	/**
	 *
	 */
	private static final long serialVersionUID = -8500433014836195629L;

	public NotLoginedException(String message, String... paras) {
		super(message, paras);
		HttpServletRequest request = RequestContext.getRequest();
		if (null==request) {
			log.error(String.format(message, paras));
		}
	}

	public NotLoginedException(String message, Throwable e, String... paras) {
		super(message, e, paras);
		HttpServletRequest request = RequestContext.getRequest();
		if (null==request) {
			log.error(String.format(message, paras));
		}
	}

	public NotLoginedException(String message, Throwable e) {
		super(message, e);
		HttpServletRequest request = RequestContext.getRequest();
		if (null==request) {
			log.error(String.format(message, e));
		}
	}

	public NotLoginedException(String message) {
		super(message);
		HttpServletRequest request = RequestContext.getRequest();
		if (null==request) {
			log.error(String.format(message));
		}
	}

}
